﻿using Common.Communal;
using MediatR;
using Scheduling.Api.Write.Application.Command.TeamTypeCommand;
using Scheduling.Services.TeamTypes;

namespace Scheduling.Api.Write.Application.CommandHandlers.TeamTypeHandler
{
    public class TeamTypeDelCommandHandler : IRequestHandler<TeamTypeDelCommand, ApiResult<int>>
    {
        public TeamTypeDelCommandHandler(ITeamTypeServices teamTypeServices)
        {
            TeamTypeServices = teamTypeServices;
        }

        public ITeamTypeServices TeamTypeServices { get; }

        public async Task<ApiResult<int>> Handle(TeamTypeDelCommand request, CancellationToken cancellationToken)
        {
            return await TeamTypeServices.DeleteTeamType(request.TeamTypeId);
        }
    }
}
